#ifndef MUSIC_H
#define MUSIC_H

#include <QWidget>
#include <QDebug>
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QSqlError>
#include <QtNetwork/QNetworkAccessManager>
#include <QJsonDocument>
#include <QStandardItemModel>
#include <QList>
#include <QMediaPlaylist>
#include <QMediaPlayer>
#include "mainwindow.h"
#include "mysql.h"
#include <QStyleOptionViewItem>
#include  <QPainter>

namespace Ui {
class music;
}

class music : public QWidget
{
    Q_OBJECT

public:
    explicit music(QWidget *parent = nullptr);

    ~music();
    QString sql_item(int row, int column);
    int sql_collect(int row, int column);
    void  sql_test(QString str);

public slots:

    void paintEvent(QPaintEvent *);
private slots:
    void on_pushButton_clicked();
    void replyFinished(QNetworkReply *reply);  // 确保这一行存在
    void parseJson(QByteArray byteArray);
    void on_tableView_doubleClicked(const QModelIndex &index);
    void positionChangedSlot(qint64 position);
    void durationChangedSlot(qint64 duration);
    void on_horizontalSlider_sliderReleased();

    void on_pushButton_2_clicked();

    void on_pushButton_3_clicked();

    void on_pushButton_4_clicked();

    void on_pushButton_5_clicked();

private:
    Ui::music *ui;
    QNetworkAccessManager * manager;
    QStandardItemModel * pModel;
    QStandardItem * item;
    QList<int> musicID;
    QList<int> musicID_coll;
    QMediaPlaylist * playlist;
    QMediaPlayer * player;
    QStandardItem * item_sql;
    QStandardItem * pItem;
    mysql * database;
    QSqlQuery query;
    int coll;
    int prev_next;
};

#endif // MUSIC_H
